<!DOCTYPE HTML>
<html>

<head>
	<title>airAuth TestCase</title>
	<meta http-equiv="pragma" content="no-cache"/>
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>

	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

	<meta name="author" content="scumyang@gmail.com"/>
	<meta name="keywords" content=""/>
	<meta name="description" content="airAuth Demo"/>
</head>

<style type="text/css">
*:focus				{outline: none;}

body
{
overflow:auto;
padding:0px;
margin:0px;
color:#ccc;
font:normal 18px "Segou UI";
background:#141414;
padding:30px;
}

body ::selection	{color:#FFFFFF;background-color:#91D250;text-shadow:none}

/** webkit 滚动条 */
::-webkit-scrollbar										{width:5px;height:5px}

::-webkit-scrollbar-button:vertical:decrement 			{width:5px;height:0px;background:#7c838a}
::-webkit-scrollbar-button:vertical:decrement:hover		{background:#c75702}
::-webkit-scrollbar-button:vertical:increment 			{width:5px;height:0px;background:#7c838a}
::-webkit-scrollbar-button:vertical:increment:hover		{background:#c75702}

::-webkit-scrollbar-button:horizontal:decrement			{width:0px;height:5px;background:#7c838a}
::-webkit-scrollbar-button:horizontal:decrement:hover	{background:#c75702}
::-webkit-scrollbar-button:horizontal:increment 		{width:0px;height:5px;background:#7c838a}
::-webkit-scrollbar-button:horizontal:increment:hover	{background:#c75702}

::-webkit-scrollbar-track								{background:#7c838a;opacity:.5}
::-webkit-scrollbar-track-piece							{background:#5a6063;opacity:1}

::-webkit-scrollbar-thumb:vertical						{background:#aaa}
::-webkit-scrollbar-thumb:vertical:hover				{background:#52e7ff}
::-webkit-scrollbar-thumb:horizontal					{background:#aaa}
::-webkit-scrollbar-thumb:horizontal:hover				{background:#52e7ff}

::-webkit-scrollbar-corner:horizontal:corner-present	{margin-right:5px;background:#c}
/*::-webkit-resizer										{width:5px;height:5px;background:#7c838a}*/

a					{font:normal 16px "微软雅黑";color:#888;transition:all .1s}
a:link				{text-decoration:none;color:#888}
a:visited			{color:#888}
a:hover				{text-decoration:none;color:#ff7300}

input,textarea
{
width:240px;
padding:5px;
font:normal 16px Consolas;
color:#ccc;
background:#202020;
border:1px inset #666;
}

select
{
height:30px;
color:#ccc;
background:#333;
border:1px solid #000000;
}

option
{
font-size:16px;
}

button
{
width:150px;
height:32px;
background:#c44;
border:1px outset #d66;
color:#fff;
transition:all 1s;
}

button:hover
{
background:#f44;
border-color:#f66;
color:#fff;
transition:all .2s;
}

button:active
{
background:#b33;
border:1px inset #c44;
color:#ddd;
}

#listGrid
{
display:grid;
display2:-webkit-flex !important;
width: 100%;
grid-template-columns:130px 2fr 160px minmax(min-content, 1fr);
border:1px solid #444;
margin-bottom:20px;
font:normal 16px Verdana;
}

#listGrid div
{
-height:35px;
line-height:35px;
padding:5px;
}

#cap
{
background:#303030;
text-align:right;
}

#cap:after
{
content:'：';
}

#val
{
background:#505050;
}

#val textarea
{
width:95%;
height:80px;
}

#op
{
background:#404040;
text-align:center;
}

#hint
{
background:#505050;
}

</style>

<script type="text/javascript" src="/repo/swatapps/lib/swatJS/swatJS-v5.js?v=1"></script>
<script type="text/javascript">
$.pageReady( function()
{
	$('#termPN').value( '' );
	$('#termIP').value( '<?=$userIP?>' );
	$('#termMAC').value( '<?=$userMAC?>' );
	$G.do_bsn();
	$G.do_versionCheck();
	
	$('input,textarea').each( function()
	{
		this.spellcheck = false;
	});
});

var $G =
{
	 authHost: '/airAuth'
	,urlParam: ''

	,do_bsn: function()
	{
		$.ajax.load(
		{
			 url: $G.authHost + "/bsn"
			,type: 'json'
			,onLoad: function( D )
			{
				$('#bsn').value( D.responseJSON.bsn );
			}
		});
	}

	,do_getIP: function()
	{
		$('#termIP').value( location.host );
	}

	,do_radiusAPI: function()
	{
		open( $('#radiusWSDL').value() );
	}

	,do_versionCheck: function()
	{
		$.ajax.load(
		{
			 url: $G.authHost + "/version"
			,type: 'json'
			,onLoad: function( D )
			{
				$('#version').value( D.responseJSON.version );
				$('#apiVer').text( '(' + D.responseJSON.version + ')' );
			}
		});
	}

	,do_depCheck: function()
	{
		open( $G.authHost + "/depCheck" );
	}
	
	,do_demoData: function()
	{
		$('#gwID').value( '00d011223344' );
		$('#gwSN').value( '1234942570128' );
		$('#gwAddr').value( '172.18.163.1' );
		$('#gwPort').value( '2060' );
		$('#termIP').value( '172.18.163.109' );
		$('#termMAC').value( '4c:2b:48:ac:55:6a' );
		$('#termSSID').value( 'ap-test' );
		$('#termURL').value( 'http://www.baidu.com/' );
	}
	
	,updateUrlParam: function()
	{
		$G.urlParam = 'gw_id={0}&gw_sn={1}&gw_address={2}&gw_port={3}&ip={4}&mac={5}&ssid={6}&url={7}'
			.format(
				$('#gwID').value(), $('#gwSN').value(), $('#gwAddr').value(), $('#gwPort').value(),
				$('#termIP').value(), $('#termMAC').value(), $('#termSSID').value(), $('#termURL').value()
			);
		$.log($G.urlParam);
	}
	
	,do_test_login: function()
	{
		$G.updateUrlParam();
		open( $('#test_login').value() + '?' + $G.urlParam );
	}
}
</script>

<body>
<h2>airAuth 移动节点认证服务-测试入口</h2>
<div id="apiVer">(正在检测接口....)</div>
<br>

<div id="listGrid">
	<div id="cap">运行环境</div>
	<div id="val"><input id="version" value=""/></div>
	<div id="op"><button onclick="$G.do_depCheck()">兼容性检测</button></div>
	<div id="hint"></div>
</div>

<div id="listGrid">
	<div id="cap">流水号</div>
	<div id="val"><input id="bsn" value=""/></div>
	<div id="op"><button onclick="$G.do_bsn()">申请 BSN</button></div>
	<div id="hint"></div>
</div>

<div id="listGrid">
	 <div id="cap">网关 ID</div>
	<div id="val"><input id="gwID" value="<?=$gwID?>"/></div>
	<div id="op"><button onclick="$G.do_demoData()">生成模拟数据</button></div>
	<div id="hint"></div>

	<div id="cap">网关 SN</div>
	<div id="val"><input id="gwSN" value="<?=$gwSN?>"/></div>
	<div id="op"></div>
	<div id="hint"></div>
	
	
	<div id="cap">网关地址</div>
	<div id="val"><input id="gwAddr" value="<?=$gwAddr?>"/></div>
	<div id="op"></div>
	<div id="hint"></div>

	<div id="cap">WiFiDog 端口</div>
	<div id="val"><input id="gwPort" value="<?=$gwPort?>"/></div>
	<div id="op"></div>
	<div id="hint"></div>
</div>

<div id="listGrid">
	<div id="cap">终端手机号</div>
	<div id="val"><input id="termPN" value=""/>
		　短信接口：<select>
		<option value="figureIt">FigureIT（风格）</optoin>
		<option value="airSpark" selected="1">AirSpark Auth</optoin>
		</select>
		</div>
	<div id="op"></div>
	<div id="hint"></div>

	<div id="cap">终端 IP</div>
	<div id="val"><input id="termIP" value="<?=$userIP?>"/></div>
	<div id="op"><button onclick="$G.do_getIP()">使用本机 IP</button></div>
	<div id="hint"></div>

	<div id="cap">终端 MAC</div>
	<div id="val"><input id="termMAC" value="<?=$userMAC?>"/></div>
	<div id="op"></div>
	<div id="hint"></div>
	
	<div id="cap">终端 SSID</div>
	<div id="val"><input id="termSSID" value="<?=$userSSID?>"/></div>
	<div id="op"></div>
	<div id="hint"></div>
	
	<div id="cap">目标 URL</div>
	<div id="val"><input id="termURL" value="<?=$userURL?>"/></div>
	<div id="op"></div>
	<div id="hint"></div>
</div>

<div id="listGrid">
	<div id="cap">RADIUS 地址</div>
	<div id="val"><input id="radiusWSDL" value="<?=RADIUS_ADDR?>" style="width:95%"/></div>
	<div id="op"><button onclick="$G.do_radiusAPI()">接口列表</button></div>
	<div id="hint"></div>
</div>

<div id="listGrid">
	<div id="cap">认证 /login</div>
	<div id="val"><input id="test_login" value="/airAuth/login" style="width:95%"/></div>
	<div id="op"><button onclick="$G.do_test_login()">测试</button></div>
	<div id="hint"></div>
</div>



<h6 style="position:absolute;top:5px;right:20px;color:#91d250"><span style="color:#fa0">&there4;</span> Copyright &copy; 2014-2017, ZensVision<sup>&trade;</sup> Co.,Ltd.</h6>

</body>
</html>